﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using QuanLyDuocPham.Controllers.QuanLyHeThong.DanhMuc;

namespace QuanLyDuocPham.View.QuanLyHeThong.DanhMuc
{
    /// <summary>
    /// Interaction logic for NCC_Add_View.xaml
    /// </summary>
    public partial class NCC_Add_View : Window
    {
        public NCC_Add_View()
        {
            InitializeComponent();
        }

        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
        string ma_ncc;
        public string _ma_ncc
        {
            set
            {
                ma_ncc = value;
            }
        }
        NCC_Control nccctrl = new NCC_Control();
        public delegate void added();
        public added done;

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            nccctrl.addData(ma_ncc, txtTen_NCC, chbThuong_Xuyen, txtDia_Chi, txtTinh_TP, txtEmail, txtDien_Thoai, txtFax, txtMST, txtNguoiDD, txtTen_TK, txtSo_TK, txtTen_NH, txtDiaChi_NH, txtGhi_Chu);
            if (done != null)
            {
                done();
            }
            ma_ncc=nccctrl.loadID_moi();
            
            txtTen_NCC.Clear();
            chbThuong_Xuyen.IsChecked=false;
            txtDia_Chi.Clear();
            txtTinh_TP.Clear();
            txtEmail.Clear();
            txtDien_Thoai.Clear();
            txtFax.Clear();
            txtMST.Clear();
            txtNguoiDD.Clear();
            txtTen_TK.Clear();
            txtSo_TK.Clear();
            txtTen_NH.Clear();
            txtDiaChi_NH.Clear();
            txtGhi_Chu.Document.Blocks.Clear();

        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ma_ncc = nccctrl.loadID_moi();

        }

        
    }
}
